﻿'use strict';

myApp.controller('ClassifiedAdsController', function ($scope, $http,$window,DUMMY_DATA) {
    $scope.$emit('newPageLoaded', {
        'title': 'Classified Ads | ShiJie Property',
        'description': "Classified Ads. We Work Very Closely With Developers. Over 40 Years Experience. Discover The Best New Properties For Auction Today!",
        'keywords': 'classified ads, classified ad, classified property ads'
    });

    //$scope.$emit('newPageLoaded', { 'title': 'Penang Realty BUY OR RENT WITH US 世界地產 Gallery', 'description': 'Beautiful property photos in Penang.' });

    $scope.images = [];

    var sizes = [
			{ w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 },
            { w: 400, h: 300 },
			{ w: 480, h: 360 },
			{ w: 640, h: 480 },
			{ w: 800, h: 600 },
			{ w: 480, h: 360 }
    ];

    var screenSize = function (width, height) {
        var x = width ? width : $window.innerWidth;
        var y = height ? height : $window.innerHeight;

        return x + 'x' + y;
    };

    function init() {
        if (DUMMY_DATA == true) {
            var data = [{ "gelleryid": "95507956-9A0A-4494-9627-77AAD0A64C40", "GelleryTitle": "Propetty for sale", "pictureURL": "https://farm2.staticflickr.com/1669/23574455223_cf9f4f6847_o.jpg", "Description": "Butterworth Residential for sale", "thumnail": "https://farm2.staticflickr.com/1669/23574455223_7a80c70d98_m.jpg" }, { "gelleryid": "98F28051-3398-4401-A3AC-5B0FC775A173", "GelleryTitle": "Factory for sale$ Rent", "pictureURL": "https://farm2.staticflickr.com/1670/24175226846_afaedc8ecd_o.jpg", "Description": "Lunas, bukit minyak,Prai factory looking for tenant and buyer", "thumnail": "https://farm2.staticflickr.com/1670/24175226846_780a12472b_m.jpg" }, { "gelleryid": "490A0714-3301-4231-8AB2-009093492269", "GelleryTitle": "Factory & Residential for sale$ Rent", "pictureURL": "https://farm2.staticflickr.com/1496/24093454612_a420811da8_o.jpg", "Description": "Light industry at Permatang Tinggi and Residential at Butterworth for sale & Rent", "thumnail": "https://farm2.staticflickr.com/1496/24093454612_d8fa6c0af9_m.jpg" }, { "gelleryid": "F9912B7C-92DA-4E3A-B9DC-44040FAC0CBB", "GelleryTitle": "property for sale and rent", "pictureURL": "https://farm8.staticflickr.com/7079/26772653562_d49d358421_o.png", "Description": "commercial", "thumnail": "https://farm8.staticflickr.com/7079/26772653562_d9cd1ae3de_m.jpg" }, { "gelleryid": "66BA2359-7725-4121-A215-458C5CB2E6B8", "GelleryTitle": "Property for sale and rent", "pictureURL": "https://farm8.staticflickr.com/7101/26260901204_6716ff7129_o.png", "Description": "Raja uda apartment, juru & simpang empat factory ", "thumnail": "https://farm8.staticflickr.com/7101/26260901204_ca1890b38a_m.jpg" }, { "gelleryid": "A7E7F401-6C08-4C3E-A575-5603803E3C00", "GelleryTitle": "?? ?? ??", "pictureURL": "https://farm8.staticflickr.com/7382/26886231860_a24cbce5c8_o.png", "Description": "Commercial.residentisl and factory fir rent and sale", "thumnail": "https://farm8.staticflickr.com/7382/26886231860_b81b453f84_m.jpg" }, { "gelleryid": "4AA96AC2-3BE2-4BAA-9F8F-C4A7A3B90340", "GelleryTitle": "?? ?? ??", "pictureURL": "https://farm8.staticflickr.com/7617/27232414195_914bdc54f2_o.png", "Description": "??", "thumnail": "https://farm8.staticflickr.com/7617/27232414195_7a5836c36b_m.jpg" }, { "gelleryid": "CA08C711-5C37-4A94-8C4E-3DEA7AF9B7DF", "GelleryTitle": "Penang island property for sale & Rent", "pictureURL": "https://farm8.staticflickr.com/7660/27198307136_a756667df2_o.png", "Description": "Factory,commercial property", "thumnail": "https://farm8.staticflickr.com/7660/27198307136_03901cb219_m.jpg" }, { "gelleryid": "0BEE4201-49B1-47A1-8C3B-D8EDE2E365D6", "GelleryTitle": "?? ?? ??", "pictureURL": "https://farm8.staticflickr.com/7336/27264635426_596c213f8d_o.png", "Description": "Commercial ", "thumnail": "https://farm8.staticflickr.com/7336/27264635426_680496d7e2_m.jpg" }, { "gelleryid": "CFFBA748-320E-4C7F-BC0A-E4B1C90D184A", "GelleryTitle": "?? ?? ??", "pictureURL": "https://farm8.staticflickr.com/7632/27297976885_b6c5955879_o.png", "Description": "Residential", "thumnail": "https://farm8.staticflickr.com/7632/27297976885_bbdf5e68f8_m.jpg" }, { "gelleryid": "93C891EE-FB7A-4B97-AD94-F46C432912E3", "GelleryTitle": "?? ?? ??", "pictureURL": "https://farm8.staticflickr.com/7394/27264685736_b7b7851278_o.png", "Description": "Factory. Commercial", "thumnail": "https://farm8.staticflickr.com/7394/27264685736_fab8d95680_m.jpg" }, { "gelleryid": "C6CD3364-3556-41A9-A718-D7CC2BC465C0", "GelleryTitle": "?? ?? ??", "pictureURL": "https://farm8.staticflickr.com/7736/27228171561_449dbaf56f_o.png", "Description": "Properties", "thumnail": "https://farm8.staticflickr.com/7736/27228171561_9296bdf4a7_m.jpg" }, { "gelleryid": "B71724AC-25EF-4E82-A1E8-AA5C2855A09A", "GelleryTitle": "?? ?? ??", "pictureURL": "https://farm8.staticflickr.com/7394/27022979860_89155a9744_o.png", "Description": "Properties", "thumnail": "https://farm8.staticflickr.com/7394/27022979860_b5c3c77d72_m.jpg" }, { "gelleryid": "FBBBF5F4-1B1F-4BBD-BCBB-0FF671DE374A", "GelleryTitle": "?????????", "pictureURL": "https://farm8.staticflickr.com/7193/26741143853_7e2218cf7f_o.png", "Description": "property", "thumnail": "https://farm8.staticflickr.com/7193/26741143853_d5a16352b9_m.jpg" }, { "gelleryid": "912068FB-94EC-417A-B52D-D97328AF49EA", "GelleryTitle": "property sale/rent", "pictureURL": "https://farm8.staticflickr.com/7670/27216876883_0b94038c94_o.png", "Description": "property", "thumnail": "https://farm8.staticflickr.com/7670/27216876883_e4f291ac27_m.jpg" }, { "gelleryid": "C322D21F-7F9D-4F69-A05D-378188F02610", "GelleryTitle": "penang property sale/rent", "pictureURL": "https://farm8.staticflickr.com/7244/27795103956_f13d0d055d_o.jpg", "Description": "property", "thumnail": "https://farm8.staticflickr.com/7244/27795103956_5476e6a6bb_m.jpg" }, { "gelleryid": "5B9FAA2A-FD98-4203-8984-A8DACF5B0A37", "GelleryTitle": "penang property sale", "pictureURL": "https://farm8.staticflickr.com/7221/27751303662_546b2dd0c3_o.png", "Description": "commercial", "thumnail": "https://farm8.staticflickr.com/7221/27751303662_3278baaa6b_m.jpg" }, { "gelleryid": "18077B11-CC4A-4A7E-ADB2-404621528AF1", "GelleryTitle": "property sale/rent", "pictureURL": "https://farm8.staticflickr.com/7432/27574854570_98af4f1850_o.png", "Description": "property", "thumnail": "https://farm8.staticflickr.com/7432/27574854570_78681cc0eb_m.jpg" }, { "gelleryid": "41D35E5E-A42E-4188-894F-AC2542299C88", "GelleryTitle": "property sale", "pictureURL": "https://farm8.staticflickr.com/7603/27872142121_0b29ced121_o.png", "Description": "residential", "thumnail": "https://farm8.staticflickr.com/7603/27872142121_0525042046_m.jpg" }, { "gelleryid": "928FACC3-53EE-4284-8F09-0492AD97B439", "GelleryTitle": "butterworth property sell/rent", "pictureURL": "https://farm8.staticflickr.com/7555/27866924855_39d6f01a60_o.png", "Description": "property", "thumnail": "https://farm8.staticflickr.com/7555/27866924855_0e04e0a255_m.jpg" }, { "gelleryid": "969B99BA-FBF3-4198-9A7A-105F7D2BABA1", "GelleryTitle": "penang property sale/rent", "pictureURL": "https://farm8.staticflickr.com/7289/27765958062_f48c759407_o.png", "Description": "property", "thumnail": "https://farm8.staticflickr.com/7289/27765958062_2fe7cccc9e_m.jpg" }, { "gelleryid": "73DA2131-5677-478E-AD3B-E597AA5488B6", "GelleryTitle": "property sale/rent", "pictureURL": "https://farm8.staticflickr.com/7391/27832800056_afa542ea9d_o.png", "Description": "property", "thumnail": "https://farm8.staticflickr.com/7391/27832800056_5e45a3fb16_m.jpg" }, { "gelleryid": "20F8B56C-92F5-47D8-9D1E-B421452A52BE", "GelleryTitle": "penang property sale/rent", "pictureURL": "https://farm8.staticflickr.com/7346/27589697870_5b031ce346_o.png", "Description": "commercial", "thumnail": "https://farm8.staticflickr.com/7346/27589697870_501159d8ea_m.jpg" }, { "gelleryid": "5DDE78A9-27E5-4265-BE5E-D12DD0866409", "GelleryTitle": "penang property sale/rent", "pictureURL": "https://farm8.staticflickr.com/7086/27810257631_ed07883e0d_o.png", "Description": "property", "thumnail": "https://farm8.staticflickr.com/7086/27810257631_36fcbe12db_m.jpg" }, { "gelleryid": "31610AF7-31D1-4D36-BA2D-3069B93D787E", "GelleryTitle": "property sale", "pictureURL": "https://farm8.staticflickr.com/7531/27485039773_33cb7d8d22_o.png", "Description": "property", "thumnail": "https://farm8.staticflickr.com/7531/27485039773_74f5141607_m.jpg" }, { "gelleryid": "9BB7B935-F675-4B21-B28B-1FC798E2746E", "GelleryTitle": "butterworth property sale", "pictureURL": "https://farm9.staticflickr.com/8735/28379581135_6fa7be4fc7_o.png", "Description": "residential", "thumnail": "https://farm9.staticflickr.com/8735/28379581135_f78c4cd391_m.jpg" }, { "gelleryid": "149E5727-078A-4194-86D6-CC03969C8D13", "GelleryTitle": "penang property sale", "pictureURL": "https://farm9.staticflickr.com/8587/27768558394_423f99d82f_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8587/27768558394_0d58be0135_m.jpg" }, { "gelleryid": "839B38F4-6F65-4B33-8B85-4E210AED3AED", "GelleryTitle": "property sale/rent", "pictureURL": "https://farm9.staticflickr.com/8637/28379631955_9db04b0e47_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8637/28379631955_aca047735f_m.jpg" }, { "gelleryid": "3F996182-59E8-44C7-B574-DBEE311F017E", "GelleryTitle": "property sale/rent", "pictureURL": "https://farm9.staticflickr.com/8634/28436111526_17d24af25a_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8634/28436111526_ef95c0e2b5_m.jpg" }, { "gelleryid": "2C305023-DDAD-47CF-A474-2CC66FF808FE", "GelleryTitle": "property sale/rent", "pictureURL": "https://farm9.staticflickr.com/8574/28468809805_039167ef0a_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8574/28468809805_ee04a106be_m.jpg" }, { "gelleryid": "ACDFEE48-84F4-4E14-ACB5-B830D18140E7", "GelleryTitle": "factory sale /rent", "pictureURL": "https://farm9.staticflickr.com/8658/28421813612_90b4f57bce_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8658/28421813612_9869927ecf_m.jpg" }, { "gelleryid": "DA6457E6-F16A-45FF-89B5-72D018F99BA4", "GelleryTitle": "butterworth property sale/rent", "pictureURL": "https://farm9.staticflickr.com/8645/28155589364_9e5cf1b897_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8645/28155589364_aa14cea1ea_m.jpg" }, { "gelleryid": "A5A5C011-B80A-4E67-B969-B4E4809FED9F", "GelleryTitle": "property sale/rent", "pictureURL": "https://farm8.staticflickr.com/7477/28696058941_b71735e73d_o.png", "Description": "property", "thumnail": "https://farm8.staticflickr.com/7477/28696058941_187aa88068_m.jpg" }, { "gelleryid": "42B351E9-3A09-4333-9E5B-D94BDF23509A", "GelleryTitle": "property for sale", "pictureURL": "https://farm9.staticflickr.com/8488/28511045820_9958e5ab1c_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8488/28511045820_3df8935648_m.jpg" }, { "gelleryid": "DCF6AE14-F2A1-4AF4-AB04-05EBB039304B", "GelleryTitle": "property sale/rent", "pictureURL": "https://farm9.staticflickr.com/8074/28219687344_775805b43a_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8074/28219687344_349769743a_m.jpg" }, { "gelleryid": "1043C355-6244-4159-A510-A4FA2DFED960", "GelleryTitle": "property sale/rent", "pictureURL": "https://farm9.staticflickr.com/8786/28732279632_e6ca1b4f64_o.png", "Description": "industrial", "thumnail": "https://farm9.staticflickr.com/8786/28732279632_24f0001141_m.jpg" }, { "gelleryid": "C6D0F679-7551-4B9D-999F-6B8C8CFEC72B", "GelleryTitle": "Property Sale/Rent ", "pictureURL": "https://farm9.staticflickr.com/8892/28864607455_968c15c806_o.png", "Description": "Property", "thumnail": "https://farm9.staticflickr.com/8892/28864607455_a521f99cf2_m.jpg" }, { "gelleryid": "0F857D9C-3D18-4CBF-A413-F939A122430B", "GelleryTitle": "property sale", "pictureURL": "https://farm9.staticflickr.com/8708/28870959806_a6c4d88730_o.png", "Description": "residential", "thumnail": "https://farm9.staticflickr.com/8708/28870959806_2f30be354d_m.jpg" }, { "gelleryid": "5BFB6BEF-AD87-4696-9D30-3FF67CE51C74", "GelleryTitle": "property sale", "pictureURL": "https://farm9.staticflickr.com/8652/28379141803_b15a9f6c53_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8652/28379141803_8fc0fdd32d_m.jpg" }, { "gelleryid": "9F287900-DB36-4F9C-827A-D1145FEAE0E2", "GelleryTitle": "penang property sale/rent", "pictureURL": "https://farm9.staticflickr.com/8667/28963702676_9f4922924d_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8667/28963702676_489cd285d9_m.jpg" }, { "gelleryid": "84530959-3F91-4474-980A-5F40AD984C17", "GelleryTitle": "property urgent sold", "pictureURL": "https://farm9.staticflickr.com/8102/29048149856_9e67fd392d_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8102/29048149856_491d07cd7e_m.jpg" }, { "gelleryid": "86C22F12-6B29-445C-81F0-415A281B30A9", "GelleryTitle": "property sale", "pictureURL": "https://farm9.staticflickr.com/8412/29039660282_e911424a6e_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8412/29039660282_720f264291_m.jpg" }, { "gelleryid": "18EA142B-E3D2-4B08-A769-1C7E8AE935F9", "GelleryTitle": "property sale/rent", "pictureURL": "https://farm9.staticflickr.com/8131/28523528354_6893feb4f5_o.png", "Description": "Industrial", "thumnail": "https://farm9.staticflickr.com/8131/28523528354_d982be400b_m.jpg" }, { "gelleryid": "E284AA2E-5382-4F18-83E1-A5E7FA2DAA30", "GelleryTitle": "property sale", "pictureURL": "https://farm9.staticflickr.com/8014/29213469545_ba15f5bf2f_o.png", "Description": "residential & commercial", "thumnail": "https://farm9.staticflickr.com/8014/29213469545_1ed82db337_m.jpg" }, { "gelleryid": "81BC02F6-091B-489C-8DDA-65B3B10BE0DC", "GelleryTitle": "land for sale", "pictureURL": "https://farm9.staticflickr.com/8178/28680857384_1dd531c138_o.png", "Description": "property urgent sold", "thumnail": "https://farm9.staticflickr.com/8178/28680857384_ae2629b1ab_m.jpg" }, { "gelleryid": "5C6E1FBB-76B5-4E10-9A78-D32E65FA1AA0", "GelleryTitle": "property sale/rent", "pictureURL": "https://farm9.staticflickr.com/8418/28682727573_7b49e1f9fb_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8418/28682727573_ee57fc6394_m.jpg" }, { "gelleryid": "077067E2-E410-4B6C-867D-62A5EB008304", "GelleryTitle": "butterworth property sale/rent", "pictureURL": "https://farm9.staticflickr.com/8796/28838866594_669f28e553_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8796/28838866594_80ca21ee51_m.jpg" }, { "gelleryid": "BF4B7D71-3AA7-4428-B713-BE3C1636A70C", "GelleryTitle": "property for sale", "pictureURL": "https://farm9.staticflickr.com/8443/29538569792_d57b216b20_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8443/29538569792_8e22666a33_m.jpg" }, { "gelleryid": "5097443E-4D07-417A-8BD7-64B9827B24B2", "GelleryTitle": "Property for sale and rent", "pictureURL": "https://farm9.staticflickr.com/8373/29697077081_8bbef73ccd_o.png", "Description": "property", "thumnail": "https://farm9.staticflickr.com/8373/29697077081_76c3d33a3f_m.jpg" }, { "gelleryid": "48BC7ADB-C2EC-4ED9-BC51-C11A6C818441", "GelleryTitle": "property for sale", "pictureURL": "https://farm8.staticflickr.com/7577/29824042535_028debf1e0_o.png", "Description": "property", "thumnail": "https://farm8.staticflickr.com/7577/29824042535_8d6e755019_m.jpg" }, { "gelleryid": "94D5A185-9C6E-4562-8882-AC79AECC1DAF", "GelleryTitle": "Butterworth property for sale", "pictureURL": "https://farm9.staticflickr.com/8413/29772162682_85899a5d45_o.png", "Description": "Residential", "thumnail": "https://farm9.staticflickr.com/8413/29772162682_ce42e9aecf_m.jpg" }, { "gelleryid": "7693D821-C690-4E4F-9A11-69BE56A29756", "GelleryTitle": "Property for sale and rent", "pictureURL": "https://farm6.staticflickr.com/5771/30088663566_3dcbaafdff_o.png", "Description": "property", "thumnail": "https://farm6.staticflickr.com/5771/30088663566_c1dc8a95ab_m.jpg" }, { "gelleryid": "93D83552-6D18-415E-BF23-60CFF4AC68C5", "GelleryTitle": "property for sale", "pictureURL": "https://farm6.staticflickr.com/5607/29495171303_0bd01e5474_o.png", "Description": "land property", "thumnail": "https://farm6.staticflickr.com/5607/29495171303_1a13e5254f_m.jpg" }, { "gelleryid": "8B689343-1D45-4B1D-9646-4AC136782624", "GelleryTitle": "butterworth property sale/rent", "pictureURL": "https://farm6.staticflickr.com/5035/30123781635_b38c67b7bf_o.png", "Description": "property", "thumnail": "https://farm6.staticflickr.com/5035/30123781635_1724d5aa6a_m.jpg" }, { "gelleryid": "19282329-4253-4353-855D-4CA8B44B18A8", "GelleryTitle": "property for sale", "pictureURL": "https://farm6.staticflickr.com/5643/30009318802_b27e30ddba_o.png", "Description": "residential", "thumnail": "https://farm6.staticflickr.com/5643/30009318802_401b1df042_m.jpg" }, { "gelleryid": "F763FB8E-1B8B-4433-B016-8713519373E9", "GelleryTitle": "property for sale", "pictureURL": "https://farm6.staticflickr.com/5458/30140876681_97e4ac4e56_o.png", "Description": "property", "thumnail": "https://farm6.staticflickr.com/5458/30140876681_d63b6be231_m.jpg" }, { "gelleryid": "4A5987CE-C177-433E-A843-B18610FFCF1F", "GelleryTitle": "bukit mertajam property for sale", "pictureURL": "https://farm6.staticflickr.com/5445/30215285033_f89d180fdb_o.png", "Description": "commercial", "thumnail": "https://farm6.staticflickr.com/5445/30215285033_74b21c2f67_m.jpg" }, { "gelleryid": "C9A4E8B8-BDF6-47CD-AAF7-3A0F5587A041", "GelleryTitle": "property for sale", "pictureURL": "https://farm6.staticflickr.com/5587/30215294893_f1b650be21_o.png", "Description": "residential", "thumnail": "https://farm6.staticflickr.com/5587/30215294893_62f83dc3a9_m.jpg" }, { "gelleryid": "7AAD1756-6DC7-4676-8648-B8F87196F49F", "GelleryTitle": "shop and factory for sale", "pictureURL": "https://farm6.staticflickr.com/5834/30734277042_8fbff9fbd7_o.png", "Description": "property", "thumnail": "https://farm6.staticflickr.com/5834/30734277042_487d642b52_m.jpg" }, { "gelleryid": "EFBB3601-7031-46A8-8FD8-159D55A0E7A6", "GelleryTitle": "condo for sale", "pictureURL": "https://farm6.staticflickr.com/5814/30850712325_967bbb2cd7_o.png", "Description": "residential", "thumnail": "https://farm6.staticflickr.com/5814/30850712325_4ef01ca893_m.jpg" }, { "gelleryid": "FDBF4F12-42EC-486B-8D2E-33D73D77CC8D", "GelleryTitle": "property for sale/rent", "pictureURL": "https://farm6.staticflickr.com/5735/30734361522_548810b6b7_o.png", "Description": "property", "thumnail": "https://farm6.staticflickr.com/5735/30734361522_169f360593_m.jpg" }];
            for (var i = 0; i < data.length; i++) {
                $scope.images.push({
                    src: data[i].pictureURL,
                    safeSrc: data[i].pictureURL,
                    thumb: data[i].pictureURL,
                    caption: data[i].Description,
                    size: screenSize(sizes[i].w, sizes[i].h),
                    type: 'image'
                });
            }
        } else {
            var url = 'api/Page/GetGallery';
            $http.get(url).success(function (data) {
                console.log("DATA: " + JSON.stringify(data));
                for (var i = 0; i < data.length; i++) {
                    $scope.images.push({
                        src: data[i].pictureURL,
                        safeSrc: data[i].pictureURL,
                        thumb: data[i].pictureURL,
                        caption: data[i].Description,
                        size: screenSize(sizes[i].w, sizes[i].h),
                        type: 'image'
                    });
                }
            });
        }
       
    }
   
    init();

    

        //for (var i = 1; i <= 5; i++) {
        //    $scope.images.push({
        //        src: "https://s-media-cache-ak0.pinimg.com/736x/64/07/19/640719d42a8107720d760349fcfbbd52.jpg",
        //        safeSrc: "https://s-media-cache-ak0.pinimg.com/736x/64/07/19/640719d42a8107720d760349fcfbbd52.jpg",
        //        thumb: "https://s-media-cache-ak0.pinimg.com/736x/64/07/19/640719d42a8107720d760349fcfbbd52.jpg",
        //        caption: 'Lorem Ipsum Dolor',
        //        size: screenSize(sizes[i - 1].w, sizes[i - 1].h),
        //        type: 'image'
        //    });
        //    console.log('CALLING...' + JSON.stringify($scope.images));
        //}

   // };

 

    //$scope.getImages();

    //$scope.images = [];
    //PageInit();

    //function PageInit() {
    //    $http.get(url).success(function (data) {
    //        console.log("Images: " + JSON.stringify(data));
    //        //$scope.data.images = data;
    //        angular.forEach(data, function (value) {
    //            $scope.images.push({ thumb: value.thumnail, img: value.pictureURL, description: value.Description });
    //        })
    //        console.log($scope.images);

    //    })
    //}
   

    

});